Base Question Visualization


In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import YouTubeVideo


:0: FutureWarning: IPython widgets are experimental and may change in the future.

In [2]:
from plotting_function import plotter,static_plot,com_plot,static_plot_com

Reading data back from npz file


In [3]:
f = open('base_question_data.npz','r')
r = np.load('base_question_data.npz')
sol_base = r['arr_0']
ic_base = r['arr_1']
f.close()

I use interact on my plotter function to plot the positions of the stars and galaxies in my system at every time value, with a slider to choose which time value to view


In [4]:
interact(plotter,ic=fixed(ic_base),sol=fixed(sol_base),n=(0,len(np.linspace(0,1.2,100))-1,1));


As can be seen, the stars behave similarly to the stars from Toomre and Toomre's paper

For an easier visual experience, I also created an animation, featured in the Animator notebook. The animation was uploaded to Youtube and is shown below:


In [5]:
YouTubeVideo('C1RoQTVU-ao',width=600,height=600)


Out[5]:

Static plots at certain times:


In [6]:
specific_t = [0,25,30,35,40,45,50,55,60,70,80,90,100]

plt.figure(figsize=(20,30))
i = 1
for n in specific_t:
    if i > 13:
        break
    else:
        plt.subplot(5,3,i)
        static_plot(ic_base,sol_base,n)
    i += 1
plt.tight_layout()


Interactive plot around center of mass between the two galaxies:


In [7]:
interact(com_plot,ic=fixed(ic_base),sol=fixed(sol_base),M=fixed(1e11),S=fixed(1e11),n=(0,len(np.linspace(0,1.2,100))-1,1));


Animation around center of mass:


In [8]:
YouTubeVideo('O1_HkrwtvPw',width=600,height=600)


Out[8]:

Static plots around center of mass:


In [9]:
specific_t = [0,25,30,35,40,45,50,55,60,70,80,90,100]

plt.figure(figsize=(20,30))
i = 1
for n in specific_t:
    if i > 13:
        break
    else:
        plt.subplot(5,3,i)
        static_plot_com(ic_base,sol_base,1e11,1e11,n)
    i += 1
plt.tight_layout()



In [ ]: